<template>
	<view class="container">
		<view class="infoBox">
			<image src="../../static/infoBg.jpg"></image>
			<view class="infomation">
				<view class="infoAvatar">
					<image src="../../static/icon/yh.png"></image>
				</view>
				<view class="infoName">{{ name }}</view>
				<view class="infoCode">商户号：{{ merchantNo }}</view>
			</view>
		</view>
		<view class="accounteBox" v-for="(item, index) in userList" :key="index" @click="goRoute(index)">
			<view class="accountLeft">
				<view class="icon">
					<image :src="item.src"></image>
				</view>
				<view class="textBox">
					<view class="textTop">
						{{ item.label }}
					</view>
					<view class="textBottom">
						{{ item.labelTwo }}
					</view>
				</view>
			</view>
			<view class="accountRight">
				<switch style="transform:scale(0.7)" v-if="index == 0" />
				<image v-if="index == 1" src="../../static/icon/right.png"></image>
			</view>
		</view>
		<view class="outBox" @click="logoutEvent">
			退出登录
		</view>
	</view>
</template>
<script setup>
	import {
		onLoad,
		onShow
	} from "@dcloudio/uni-app";
	import {
		ref,
		reactive
	} from "vue";
	import {
		useStore
	} from "@/store";
	/** store实例 */
	const store = useStore();
	let userList = ref([{
			label: "合并入帐",
			labelTwo: "开启后系统自动合并入帐",
			src: '../../static/icon/zsk.png',
		},
		{
			label: "结算卡管理",
			labelTwo: "描述信息",
			src: '../../static/icon/yhk.png',
		},
		{
			label: "实名认证",
			labelTwo: "描述信息",
			src: '../../static/icon/ry.png',
		},
		{
			label: "身份证更新",
			labelTwo: "描述信息",
			src: '../../static/icon/ry.png',
		},
		{
			label: "设置",
			labelTwo: "描述信息",
			src: '../../static/icon/ry.png',
		}
	]);
	let name = ref(store.userInfo.name)
	let merchantNo = ref(store.currentMerchantInfomation.merchantNo)
	let goRoute = (val) => {
		if (val === 4) {
			uni.navigateTo({
				url: "/pagesLogin/setting/index",
			});
		} else if (val === 1) {
			uni.navigateTo({
				url: "/authentication/realBank/index",
			});
		} else if (val === 2) {
			uni.navigateTo({
				url: "/authentication/realName/index",
			});
		}
	}
	// 退出登录
	let logoutEvent = () => {
		// let params = {
		// 	token:
		// }
		// useStore()
		// 	.logout()
		// 	.then(() => {
		// 		uni.reLaunch({ url: "/pages/login/index" });
		// 	});
		uni.reLaunch({
			url: "/pages/login/index"
		});
	}
</script>
<style lang="scss" scoped>
	@import "./index.scss";
</style>
<style>
	page {
		background-color: #FFF;
	}
</style>